package com.example.demo.service.imp;
import com.example.demo.dao.IUser;
import com.example.demo.entity.User;
import com.example.demo.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;


@Service
@Transactional
class UserServiceImp implements UserService {

    @Autowired
    private IUser iUser;

    /*添加用户*/
    @Override
    public int insertUser(User user) {
        return iUser.insertUser(user);
    }

    /*根据Id删除用户*/
    @Override
    public int deleteUserById(int id) {
        return iUser.deleteUserById(id);
    }

    /*更新用户信息*/
    @Override
    public int updateUser(User user) {
        return iUser.updateUser(user);
    }

    /*查询所有用户信息*/
    @Override
    public List<User> selectAllUser() {
        return iUser.selectAllUser();
    }

    /*根据Id查询用户信息*/
    @Override
    public User selectUserById(int id) {
        return iUser.selectUserById(id);
    }
}
